using System;
using GHIElectronics.NETMF.Hardware;
using InternetThermostat.Models;
using GHIElectronics.NETMF.FEZ;

namespace InternetThermostat
{
    public class AppSettings
    {

        public static byte[] IPAddress = { 192, 168, 1, 222 };
        public static byte[] IPMask = { 255, 255, 255, 0 };
        public static byte[] IPGateway = { 192, 168, 1, 1 };
        public static byte[] MACAddress = { 0x00, 0x88, 0x98, 0x90, 0xD4, 0xE0 };

        public static short HttpPort = 80;
        public static short MaxPostDataLength = 2048;
        public static string HttpPrefix = "http";

        public static bool DHCPEnabled { get { return false; } }
        public static string HostName { get { return "Panda"; } }

        public static string NTPServer = "us.pool.ntp.org";
        public static short NTPOffsetInt = -6 * 60;

        public static AnalogIn.Pin ThermometerPin = AnalogIn.Pin.Ain3;
        public static short ThermometerMinValue = -89;
        public static short ThermometerMaxValue = 733;

        public static FEZ_Components.FEZTouch.Font Font;

        //public static FEZ_Components.FEZTouch.Orientation LCDOrientation = FEZ_Components.FEZTouch.Orientation.Landscape;


        public static Dictionary GetDefaultSchedule()
        {
            Dictionary weeklySchedule = new Dictionary();

            // Weekdays
            for (var day = DayOfWeek.Monday; day < DayOfWeek.Friday; day++)
            {
                var morningWakeUp = new DayTime { Day = day, Hour = 7, Minute = 30 };
                var morningLeave = new DayTime { Day = day, Hour = 9, Minute = 00 };
                var eveningArrive = new DayTime { Day = day, Hour = 5 + 12, Minute = 30 }; ;
                var eveningSleep = new DayTime { Day = day, Hour = 11 + 12, Minute = 30 };

                weeklySchedule.Add(morningWakeUp, 68);
                weeklySchedule.Add(morningLeave, 58);
                weeklySchedule.Add(eveningArrive, 68);
                weeklySchedule.Add(eveningSleep, 60);
            }


            // Sunday
            {
                var morningWakeUp = new DayTime { Day = DayOfWeek.Sunday, Hour = 9, Minute = 30 };
                var eveningSleep = new DayTime { Day = DayOfWeek.Sunday, Hour = 11 + 12, Minute = 30 };

                weeklySchedule.Add(morningWakeUp, 68);
                weeklySchedule.Add(eveningSleep, 60);
            }

            // Sunday
            {
                var morningWakeUp = new DayTime { Day = DayOfWeek.Saturday, Hour = 9, Minute = 30 };
                var eveningSleep = new DayTime { Day = DayOfWeek.Saturday, Hour = 1, Minute = 00 };

                weeklySchedule.Add(morningWakeUp, 68);
                weeklySchedule.Add(eveningSleep, 60);
            }

            return weeklySchedule;
        }

    }
}
